home *** CD-ROM | disk | FTP | other *** search
/ Mastering Web Site Development / Microsoft Mastering Web Site Development (Microsoft) (1997).iso / Demo Code / Ch10 / grades.asp next >
Text File  |  1997-04-24  |  1KB  |  49 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2.  
  3. <HTML>
  4. <HEAD>
  5. <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
  6. <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
  7. <TITLE>Document Title</TITLE>
  8. </HEAD>
  9. <BODY>
  10.  
  11. <!-- Insert HTML here -->
  12. <%
  13. Const adOpenKeyset=1
  14. Const adLockOptimistic = 3 %>
  15. You logged on as: <%=request.servervariables("LOGON_USER") %> <p>
  16. <TABLE>
  17. <%
  18. login=request.servervariables("LOGON_USER")
  19. set rs = Server.CreateObject ("ADODB.Recordset")
  20. if strcomp (login, "instructor",1) = 0 THEN
  21.   rs.Open "Select StudentID, Grade from enrollment", _
  22.   "DSN=Stateu;DATABASE=StateU;UID=sa;PWD="
  23. else
  24.   rs.Open "Select ClassID, StudentID from enrollment", _
  25.     "DSN=stateu;DATABASE=StateU;UID=sa;PWD="
  26. end if
  27.  
  28. Set StateU = Server.CreateObject("ADODB.Connection")
  29. response.write "<TR>"
  30. response.write "<TH>" & rs.fields(0).name & "</TH>"
  31. response.write "<TH>" & rs.fields(1).name & "</TH>"
  32. response.write "</TR>"
  33.  
  34. Do Until rs.EOF
  35.     response.write "<TR>"
  36.     response.write "<TD>" & rs.fields(0).value & "</TD>"
  37.     if isnull(rs.fields(1).value) then 
  38.     response.write "<TD>Unavailable</TD>"
  39.     else
  40.         response.write "<TD>" & rs.fields(1).value & "</TD>"
  41.     end if
  42.     response.write "</TR>"
  43.     rs.MoveNext
  44. Loop
  45. %>
  46. </Table>
  47. </BODY>
  48. </HTML>
  49.